import java.util.Scanner;
import java.util.Stack;

//点击消除
//输入字符串,字符串中相邻字母两两相同则消除,直到无法进行消除为止,如果消除后字符串为空,则输出0,反之输出消除后的字符串
public class test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s1 = in.next();
        char[] arr = s1.toCharArray();
        Stack<Character> stack = new Stack<Character>();
        Stack<Character> stack1 = new Stack<Character>();
        for (char a:arr){
            if(stack.empty()){
                stack.push(a);
            }else{
                if(stack.peek()==a){
                    stack.pop();
                }else{
                    stack.push(a);
                }
            }
        }
        if (stack.empty()){
            System.out.println("0");
        }else {
            while (!stack.empty()){
                stack1.push(stack.pop());
            }
            while (!stack1.empty()){
                System.out.print(stack1.pop());
            }
        }
    }
}
